<?php
header('Content-type:text/html;charset=utf-8');

//包含数据库配置
include '../../public/peizhi.php';

//包含函数
include '../../public/func.php';

//接值
$fq_name = $_POST['fq_name'];

if(strlen($fq_name) > 20 || empty(strlen($fq_name))){
	exit('<script>alert("没有输入分区名或分区名超过20字");window.location.href="add.php";</script>');
}

//调用函数
$link = db();

//准备SQL语句
$sql = "insert into fenqu(fq_name) values('{$fq_name}')";

//执行SQL语句
if($res = mysqli_query($link,$sql)){
	echo '<script>alert("添加分区成功");window.location.href="show.php";</script>';
}else{
	echo '<script>alert("添加分区失败");window.location.href="add.php";</script>';
}

//关闭数据库连接
mysqli_close($link);


